<template>
  <div>
    <van-nav-bar
      :z-index="999"
      :fixed="true"
      left-arrow
      @click-left="onClickLeft"
      :placeholder="true"
      title="全部考场"
    ></van-nav-bar>
    <div class="in-panel-place">
      <van-cell
        class="place-cell"
        center
        v-for="(item, i) in placelists"
        :key="i"
      >
        <!-- <template #icon>
          <div class="place-pic">
            <img :src="baseURL+item.img" />
          </div>
        </template>-->
        <template #title>
          <div class="place-head justify">
            <div class="pl-tit">{{ item.mc }}</div>
            <div class="pl-item">{{ item.km == 1 ? "科目二" : "科目三" }}</div>
          </div>
          <div class="place-foot justify">
            <div class="pl-ads">{{ item.dz }}</div>
            <div class="pl-km">{{ item.juli }}km</div>
          </div>
        </template>
      </van-cell>
    </div>
  </div>
</template>

<script>
import { detalisSite } from "../../assets/js/api/apply";
import { baseURL } from "../../assets/js/config";
export default {
  name: "ExaminationRoom",
  data() {
    return {
      placelists: [
        // {
        //   pic: require("../../assets/banner1.jpg"),
        //   title: "成功驾校训练场",
        //   address: "河北省石家庄市新华区张石高"
        // }
      ],
      precision: null, // 精度
      // 114.495438,38.040065
      dimensionality: null // 维度
    };
  },

  mounted() {
    // console.log("考场");
    if (sessionStorage.getItem("jd")) {
      this.precision = sessionStorage.getItem("wd");
    }
    if (sessionStorage.getItem("wd")) {
      this.dimensionality = sessionStorage.getItem("wd");
    }
    this.baseURL = baseURL;
    // let url = location.href;
    // console.log(url);
    // let lid = url.split("=");
    // lid = lid[1];
    // console.log(lid);
    let obj = {
      code: this.$route.params.lid,
      jd: this.precision,
      wd: this.dimensionality
    };
    detalisSite(obj).then(res => {
      // console.log(res.data);
      this.placelists = res.data;
    });
  },

  methods: {
    onClickLeft() {
      this.$router.go(-1);
    }
  },
  created() {
    let dsBridge = require("dsbridge");
    dsBridge.call("goBack", "", function() {
      history.go(-1);
    });
  }
};
</script>

<style></style>
